home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Icon 8.1 / msm-2 / runtime.sit / data.r < prev    next >
Encoding:
Text File  |  1992-09-19  |  10.4 KB  |  458 lines  |  [TEXT/MPS ]

  1. /*
  2.  * data.r -- Various interpreter data tables.
  3.  */
  4.  
  5. #if !COMPILER
  6.  
  7. struct b_proc Bnoproc;
  8.  
  9. /*
  10.  * External declarations for function blocks.
  11.  */
  12.  
  13. #ifdef Xver
  14. xver(idata.1)
  15. #else                    /* Xver */
  16. #define FncDef(p,n) extern struct b_proc Cat(B,p);
  17. #define FncDefV(p) extern struct b_proc Cat(B,p);
  18. #include "::h:fdefs.h"
  19. #undef FncDef
  20. #undef FncDefV
  21. #endif                    /* Xver */
  22.  
  23. #define OpDef(p,n,s) extern struct b_proc Cat(B,p);
  24. #include "::h:odefs.h"
  25. #undef OpDef
  26.  
  27. extern struct b_proc Bbscan;
  28. extern struct b_proc Bescan;
  29. extern struct b_proc Bfield;
  30. extern struct b_proc Blimit;
  31. extern struct b_proc Bllist;
  32.  
  33. #ifdef Xver
  34. xver(idata.2)
  35. #else                    /* Xver */
  36. /* delete this Xfer */
  37. #endif                    /* Xver */
  38.  
  39.  
  40. #ifdef TraceBack
  41.  
  42. struct b_proc *opblks[] = {
  43.     NULL,
  44. #define OpDef(p,n,s) Cat(&B,p),
  45. #include "::h:odefs.h"
  46. #undef OpDef
  47.    &Bbscan,
  48.    NULL,
  49.    NULL,
  50.    NULL,
  51.    NULL,
  52.    NULL,
  53.    NULL,
  54.    NULL,
  55.    NULL,
  56.    NULL,
  57.    NULL,
  58.    &Bescan,
  59.    NULL,
  60.    &Bfield,
  61.    NULL,
  62.    NULL,
  63.    NULL,
  64.    NULL,
  65.    NULL,
  66.    &Blimit,
  67.    &Bllist,
  68.    NULL,
  69.    NULL,
  70.    NULL
  71.    };
  72. #endif                    /* TraceBack */
  73.  
  74. /*
  75.  * Array of names and corresponding functions.
  76.  */
  77.  
  78. struct pstrnm pntab[] = {
  79.  
  80. #ifndef Xver
  81. #define FncDef(p,n) Lit(p), Cat(&B,p),
  82. #define FncDefV(p) Lit(p), Cat(&B,p),
  83. #include "::h:fdefs.h"
  84. #undef FncDef
  85. #undef FncDefV
  86. #else                    /* Xver */
  87. xver(idata.2a)
  88. #endif                    /* Xver */
  89.  
  90. #define OpDef(p,n,s) s, Cat(&B,p),
  91. #include "::h:odefs.h"
  92. #undef OpDef
  93.     0,         0
  94.     };
  95.  
  96. int pnsize = (sizeof(pntab) / sizeof(struct pstrnm)) - 1;
  97.  
  98. #endif                    /* COMPILER */
  99.  
  100. /*
  101.  * Structures for built-in values.  Parts of some of these structures are
  102.  *  initialized later. Since some C compilers cannot handle any partial
  103.  *  initializations, all parts are initialized later if any have to be.
  104.  */
  105.  
  106. /*
  107.  * blankcs; a cset consisting solely of ' '.
  108.  */
  109. struct b_cset  blankcs = {
  110.    T_Cset,
  111.    1,
  112. #if !EBCDIC
  113.    cset_display(0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  114. #else                    /* EBCDIC */
  115.    cset_display(0, 0, 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  116. #endif                    /* EBCDIC */
  117.    };
  118.  
  119. /*
  120.  * lparcs; a cset consisting solely of '('.
  121.  */
  122. struct b_cset  lparcs = {
  123.    T_Cset,
  124.    1,
  125. #if !EBCDIC
  126.    cset_display(0, 0, 0400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  127. #else                    /* EBCDIC */
  128.    cset_display(0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  129. #endif                    /* EBCDIC */
  130.    };
  131.  
  132. /*
  133.  * rparcs; a cset consisting solely of ')'.
  134.  */
  135. struct b_cset  rparcs = {
  136.    T_Cset,
  137.    1,
  138. #if !EBCDIC
  139.    cset_display(0, 0, 01000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  140. #else                    /* EBCDIC */
  141.    cset_display(0, 0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  142. #endif                    /* EBCDIC */
  143.    };
  144.  
  145. /*
  146.  * fullcs - all 256 bits on.
  147.  */
  148. struct b_cset  fullcs = {
  149.    T_Cset,
  150.    256,
  151.    cset_display(~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0,
  152.         ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0)
  153.    };
  154.  
  155. #if !COMPILER
  156.  
  157. /*
  158.  * Built-in csets
  159.  */
  160.  
  161. /*
  162.  * &digits; bits corresponding to 0-9 are on.
  163.  */
  164. struct b_cset  k_digits = {
  165.    T_Cset,
  166.    10,
  167.  
  168. #if EBCDIC != 1
  169.    cset_display(0,  0,    0,  0x3ff, 0,  0, 0,  0,
  170.         0,  0,    0,  0,     0,  0,     0,  0)
  171. #else                    /* EBCDIC != 1*/
  172.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  173.         0,  0,    0,  0,  0,  0,  0,  0x3ff)
  174. #endif                    /* EBCDIC != 1 */
  175.  
  176.    };
  177.  
  178. /*
  179.  * Cset for &lcase; bits corresponding to lowercase letters are on.
  180.  */
  181. struct b_cset  k_lcase = {
  182.    T_Cset,
  183.    26,
  184.  
  185. #if EBCDIC != 1
  186.    cset_display(0,  0,    0,  0,    0,  0,    ~01,  03777,
  187.         0,  0,    0,  0,    0,  0,    0,  0)
  188. #else                    /* EBCDIC != 1 */
  189.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  190.         0x3fe,    0x3fe,    0x3fc,    0,  0,    0,  0,    0)
  191. #endif                    /* EBCDIC != 1 */
  192.  
  193.    };
  194.  
  195. /*
  196.  * &ucase; bits corresponding to uppercase characters are on.
  197.  */
  198. struct b_cset  k_ucase = {
  199.    T_Cset,
  200.    26,
  201.  
  202. #if EBCDIC != 1
  203.    cset_display(0,  0,    0,  0,    ~01,  03777, 0, 0,
  204.         0,  0,    0,  0,    0,  0,    0,  0)
  205. #else                    /* EBCDIC != 1 */
  206.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  207.         0,  0,    0,  0,    0x3fe,    0x3fe,    0x3fc,    0)
  208. #endif                    /* EBCDIC != 1 */
  209.  
  210.    };
  211.  
  212. /*
  213.  * &letters; bits corresponding to letters are on.
  214.  */
  215. struct b_cset  k_letters = {
  216.    T_Cset,
  217.    52,
  218.  
  219. #if EBCDIC != 1
  220.    cset_display(0,  0,    0,  0,    ~01,  03777, ~01, 03777,
  221.         0,  0,    0,  0,    0,  0,    0,  0)
  222. #else                    /* EBCDIC != 1 */
  223.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  224.         0x3fe,  0x3fe,    0x3fc,  0, 0x3fe, 0x3fe, 0x3fc,    0)
  225. #endif                    /* EBCDIC != 1 */
  226.  
  227.    };
  228. #endif                    /* COMPILER */
  229.  
  230. /*
  231.  * Built-in files.
  232.  */
  233.  
  234. #ifndef MultiThread
  235. struct b_file  k_errout = {T_File, NULL, Fs_Write};    /* &errout */
  236. struct b_file  k_input = {T_File, NULL, Fs_Read};    /* &input */
  237. struct b_file  k_output = {T_File, NULL, Fs_Write};    /* &output */
  238. #endif                    /* MultiThread */
  239.  
  240. #ifdef EventMon
  241. /*
  242.  *  Real block needed for event monitoring.
  243.  */
  244.  
  245. struct b_real realzero = {T_Real, 0.0};
  246.  
  247. #endif                    /* EventMon */
  248. /*
  249.  * Keyword variables.
  250.  */
  251. #ifndef MultiThread
  252. struct descrip kywd_err = {D_Integer};  /* &error */
  253. struct descrip kywd_pos = {D_Integer};    /* &pos */
  254. struct descrip kywd_prog;        /* &progname */
  255. struct descrip k_subject;         /* &subject */
  256. struct descrip kywd_ran = {D_Integer};    /* &random */
  257. struct descrip kywd_trc = {D_Integer};    /* &trace */
  258. #endif                    /* MultiThread */
  259.  
  260. struct descrip nullptr =
  261.    {F_Ptr | F_Nqual};                    /* descriptor with null block pointer */
  262. struct descrip trashcan;        /* descriptor that is never read */
  263.  
  264. /*
  265.  * Various constant descriptors.
  266.  */
  267.  
  268. struct descrip blank;             /* one-character blank string */
  269. struct descrip emptystr;         /* zero-length empty string */
  270. struct descrip lcase;            /* string of lowercase letters */
  271. struct descrip letr;            /* "r" */
  272. struct descrip nulldesc = {D_Null};    /* null value */
  273. struct descrip onedesc = {D_Integer};    /* integer 1 */
  274. struct descrip ucase;            /* string of uppercase letters */
  275. struct descrip zerodesc = {D_Integer};    /* integer 0 */
  276.  
  277. #ifdef EventMon
  278. /*
  279.  * Descriptors used by event monitoring.
  280.  */
  281. struct descrip csetdesc = {D_Cset};
  282. struct descrip eventdesc;
  283. struct descrip rzerodesc = {D_Real};
  284. #endif                    /* EventMon */
  285.  
  286. /*
  287.  * An array of all characters for use in making one-character strings.
  288.  */
  289.  
  290. unsigned char allchars[256] = {
  291.      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  292.     16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  293.     32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  294.     48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
  295.     64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
  296.     80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
  297.     96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
  298.    112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
  299.    128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
  300.    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
  301.    160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
  302.    176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
  303.    192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
  304.    208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
  305.    224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
  306.    240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
  307. };
  308.  
  309. /*
  310.  * Run-time error numbers and text.
  311.  */
  312. struct errtab errtab[] = {
  313.    101, "integer expected or out of range",
  314.    102, "numeric expected",
  315.    103, "string expected",
  316.    104, "cset expected",
  317.    105, "file expected",
  318.    106, "procedure or integer expected",
  319.    107, "record expected",
  320.    108, "list expected",
  321.    109, "string or file expected",
  322.    110, "string or list expected",
  323.    111, "variable expected",
  324.    112, "invalid type to size operation",
  325.    113, "invalid type to random operation",
  326.    114, "invalid type to subscript operation",
  327.    115, "list, set, or table expected",
  328.    116, "invalid type to element generator",
  329.    117, "missing main procedure",
  330.    118, "co-expression expected",
  331.    119, "set expected",
  332.    120, "two csets or two sets expected",
  333.    121, "function not supported",
  334.    122, "set or table expected",
  335.    123, "invalid type",
  336.    124, "table expected",
  337.    125, "list or set expected",
  338.  
  339. #ifdef EventMon
  340.    126, "improper event monitoring setup",
  341. #endif                    /* EventMon */
  342.  
  343. #ifdef XIcon
  344.    140, "window expected",
  345.    141, "program terminated by window manager",
  346.    142, "attempt to read/write on closed window",
  347. #endif                    /* XIcon */
  348.  
  349.    201, "division by zero",
  350.    202, "remaindering by zero",
  351.    203, "integer overflow",
  352.    204, "real overflow, underflow, or division by zero",
  353.    205, "value out of range",
  354.    206, "negative first argument to real exponentiation",
  355.    207, "invalid field name",
  356.    208, "second and third arguments to map of unequal length",
  357.    209, "invalid second argument to open",
  358.    210, "non-ascending arguments to detab/entab",
  359.    211, "by value equal to zero",
  360.    212, "attempt to read file not open for reading",
  361.    213, "attempt to write file not open for writing",
  362.    214, "input/output error",
  363.    215, "attempt to refresh &main",
  364.    216, "external function not found",
  365.  
  366. #ifdef Xver
  367. xver(idata.4)
  368. #endif                    /* Xver */
  369.  
  370.    301, "evaluation stack overflow",
  371.    302, "system stack overflow",
  372.    303, "inadequate space for evaluation stack",
  373.  
  374. #ifdef FixedRegions
  375.    304, "inadequate space in qualifier list",
  376. #endif                    /* FixedRegions */
  377.  
  378.    305, "inadequate space for static allocation",
  379.    306, "inadequate space in string region",
  380.    307, "inadequate space in block region",
  381.    308, "system stack overflow in co-expression",
  382.  
  383. #if IntBits == 16
  384.    316, "interpreter stack too large",
  385.    318, "co-expression stack too large",
  386. #endif                    /* IntBits == 16 */
  387.  
  388. #if VMS
  389.    351, "insufficient MAXMEM limit",
  390. #endif                    /* VMS */
  391.  
  392. #ifdef Xver
  393. xver(idata.4)
  394. #endif                    /* Xver */
  395.  
  396. #ifndef Coexpr
  397.    401, "co-expressions not implemented",
  398. #endif                    /* Coexpr */
  399.    402, "program not compiled with debugging option",
  400.  
  401.    500, "program malfunction",        /* for use by runerr() */
  402.  
  403. /*
  404.  * End of operating-system specific code.
  405.  */
  406.  
  407.    0,    ""
  408.    };
  409.  
  410. /*
  411.  * Note:  the following material is here to avoid a bug in the Cray C compiler.
  412.  */
  413.  
  414. #if !COMPILER
  415. #define OpDef(p,n,s) int Cat(O,p) Params((dptr cargp));
  416. #include "::h:odefs.h"
  417. #undef OpDef
  418.  
  419. /*
  420.  * When an opcode n has a subroutine call associated with it, the
  421.  *  nth word here is the routine to call.
  422.  */
  423.  
  424. int (*optab[])() = {
  425.     err,
  426. #define OpDef(p,n,s) Cat(O,p),
  427. #include "::h:odefs.h"
  428. #undef OpDef
  429.    Obscan,
  430.    err,
  431.    err,
  432.    err,
  433.    err,
  434.    err,
  435.    Ocreate,
  436.    err,
  437.    err,
  438.    err,
  439.    err,
  440.    Oescan,
  441.    err,
  442.    Ofield
  443.    };
  444.  
  445. /*
  446.  *  Keyword function look-up table.
  447.  */
  448. #define KDef(p) int Cat(K,p) Params((dptr cargp));
  449. #include "::h:kdefs.h"
  450. #undef KDef
  451.  
  452. int (*keytab[])() = {
  453.    err,
  454. #define KDef(p) Cat(K,p),
  455. #include "::h:kdefs.h"
  456.    };
  457. #endif                    /* !COMPILER */
  458.